/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    cn-qingdao = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-beijing = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-chengdu = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-zhangjiakou = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-huhehaote = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-hangzhou = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-shanghai = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-shenzhen = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-heyuan = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-wulanchabu = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-hongkong = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-2 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-3 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-5 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    eu-west-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    us-west-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    us-east-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    eu-central-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    me-east-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-south-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    cn-shanghai-finance-1 = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-shenzhen-finance-1 = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-north-2-gov-1 = 'wafopenapi.cn-hangzhou.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('waf-openapi', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateCertificateRequest {
  certificate?: string(name='Certificate', example='-----BEGIN CERTIFICATE----- 62EcYPWd2Oy1vs6MTXcJSfN9Z7rZ9fmxWr2BFN2XbahgnsSXM48ixZJ4krc+1M+j2kcubVpsE2cgHdj4v8H6jUz9Ji4mr7vMNS6dXv8PUkl/qoDeNGCNdyTS5NIL5ir+g92cL8IGOkjgvhlqt9vc65Cgb4mL+n5+DV9uOyTZTW/MojmlgfUekC2xiXa54nxJf17Y1TADGSbyJbsC0Q9nIrHsPl8YKkvRWvIAqYxXZ7wRwWWmv4TMxFhWRiNY7yZIo2ZUhl02SIDNggIEeg== -----END CERTIFICATE-----'),
  certificateName?: string(name='CertificateName', description='This parameter is required.', example='CertName'),
  domain?: string(name='Domain', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  privateKey?: string(name='PrivateKey', description='This parameter is required.', example='-----BEGIN RSA PRIVATE KEY----- DADTPZoOHd9WtZ3UKHJTRgNQmioPQn2bqdKHop+B/dn/4VZL7Jt8zSDGM9sTMThLyvsmLQKBgQCr+ujntC1kN6pGBj2Fw2l/EA/W3rYEce2tyhjgmG7rZ+A/jVE9fld5sQra6ZdwBcQJaiygoIYoaMF2EjRwc0qwHaluq0C15f6ujSoHh2e+D5zdmkTg/3NKNjqNv6xA2gYpinVDzFdZ9Zujxvuh9o4Vqf0YF8bv5UK5G04RtKadOw== -----END RSA PRIVATE KEY-----'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model CreateCertificateResponseBody = {
  certificateId?: long(name='CertificateId', example='2329260'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model CreateCertificateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCertificateResponseBody(name='body'),
}

/**
 * @param request CreateCertificateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCertificateResponse
 */
async function createCertificateWithOptions(request: CreateCertificateRequest, runtime: Util.RuntimeOptions): CreateCertificateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.certificate)) {
    query['Certificate'] = request.certificate;
  }
  if (!Util.isUnset(request.certificateName)) {
    query['CertificateName'] = request.certificateName;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.privateKey)) {
    query['PrivateKey'] = request.privateKey;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCertificate',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateCertificateRequest
 * @return CreateCertificateResponse
 */
async function createCertificate(request: CreateCertificateRequest): CreateCertificateResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCertificateWithOptions(request, runtime);
}

model CreateCertificateByCertificateIdRequest {
  certificateId?: long(name='CertificateId', description='This parameter is required.', example='3384669'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-zz11sr5****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model CreateCertificateByCertificateIdResponseBody = {
  certificateId?: long(name='CertificateId', example='3384669'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model CreateCertificateByCertificateIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCertificateByCertificateIdResponseBody(name='body'),
}

/**
 * @param request CreateCertificateByCertificateIdRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCertificateByCertificateIdResponse
 */
async function createCertificateByCertificateIdWithOptions(request: CreateCertificateByCertificateIdRequest, runtime: Util.RuntimeOptions): CreateCertificateByCertificateIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.certificateId)) {
    query['CertificateId'] = request.certificateId;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCertificateByCertificateId',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateCertificateByCertificateIdRequest
 * @return CreateCertificateByCertificateIdResponse
 */
async function createCertificateByCertificateId(request: CreateCertificateByCertificateIdRequest): CreateCertificateByCertificateIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCertificateByCertificateIdWithOptions(request, runtime);
}

model CreateDomainRequest {
  accessHeaderMode?: int32(name='AccessHeaderMode', example='0'),
  accessHeaders?: string(name='AccessHeaders', example='["X-Client-IP"]'),
  accessType?: string(name='AccessType', example='waf-cloud-dns'),
  cloudNativeInstances?: string(name='CloudNativeInstances', example='[{"ProtocolPortConfigs":[{"Ports":[80],"Protocol":"http"}],"RedirectionTypeName":"ALB","InstanceId":"alb-s65nua68wdedsp****","IPAddressList":["182.XX.XX.113"],"CloudNativeProductName":"ALB"}]'),
  clusterType?: int32(name='ClusterType', example='0'),
  connectionTime?: int32(name='ConnectionTime', example='5'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  http2Port?: string(name='Http2Port', example='[443]'),
  httpPort?: string(name='HttpPort', example='[80]'),
  httpToUserIp?: int32(name='HttpToUserIp', example='0'),
  httpsPort?: string(name='HttpsPort', example='[443]'),
  httpsRedirect?: int32(name='HttpsRedirect', example='0'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-7pp26f1****'),
  ipFollowStatus?: int32(name='IpFollowStatus', example='1'),
  isAccessProduct?: int32(name='IsAccessProduct', description='This parameter is required.', example='0'),
  keepalive?: boolean(name='Keepalive'),
  keepaliveRequests?: int32(name='KeepaliveRequests'),
  keepaliveTimeout?: int32(name='KeepaliveTimeout'),
  loadBalancing?: int32(name='LoadBalancing', example='0'),
  logHeaders?: string(name='LogHeaders', example='[{"k":"ALIWAF-TAG","v":"Yes"}]'),
  readTime?: int32(name='ReadTime', example='120'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-atstuj3rtop****'),
  retry?: boolean(name='Retry'),
  sniHost?: string(name='SniHost', example='waf.example.com'),
  sniStatus?: int32(name='SniStatus', example='1'),
  sourceIps?: string(name='SourceIps', example='["39.XX.XX.197"]'),
  writeTime?: int32(name='WriteTime', example='120'),
}

model CreateDomainResponseBody = {
  cname?: string(name='Cname', example='mmspx7qhfvnfzggheh1g2wnbhog66vcv.****.com'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model CreateDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDomainResponseBody(name='body'),
}

/**
 * @param request CreateDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDomainResponse
 */
async function createDomainWithOptions(request: CreateDomainRequest, runtime: Util.RuntimeOptions): CreateDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessHeaderMode)) {
    query['AccessHeaderMode'] = request.accessHeaderMode;
  }
  if (!Util.isUnset(request.accessHeaders)) {
    query['AccessHeaders'] = request.accessHeaders;
  }
  if (!Util.isUnset(request.accessType)) {
    query['AccessType'] = request.accessType;
  }
  if (!Util.isUnset(request.cloudNativeInstances)) {
    query['CloudNativeInstances'] = request.cloudNativeInstances;
  }
  if (!Util.isUnset(request.clusterType)) {
    query['ClusterType'] = request.clusterType;
  }
  if (!Util.isUnset(request.connectionTime)) {
    query['ConnectionTime'] = request.connectionTime;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.http2Port)) {
    query['Http2Port'] = request.http2Port;
  }
  if (!Util.isUnset(request.httpPort)) {
    query['HttpPort'] = request.httpPort;
  }
  if (!Util.isUnset(request.httpToUserIp)) {
    query['HttpToUserIp'] = request.httpToUserIp;
  }
  if (!Util.isUnset(request.httpsPort)) {
    query['HttpsPort'] = request.httpsPort;
  }
  if (!Util.isUnset(request.httpsRedirect)) {
    query['HttpsRedirect'] = request.httpsRedirect;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ipFollowStatus)) {
    query['IpFollowStatus'] = request.ipFollowStatus;
  }
  if (!Util.isUnset(request.isAccessProduct)) {
    query['IsAccessProduct'] = request.isAccessProduct;
  }
  if (!Util.isUnset(request.keepalive)) {
    query['Keepalive'] = request.keepalive;
  }
  if (!Util.isUnset(request.keepaliveRequests)) {
    query['KeepaliveRequests'] = request.keepaliveRequests;
  }
  if (!Util.isUnset(request.keepaliveTimeout)) {
    query['KeepaliveTimeout'] = request.keepaliveTimeout;
  }
  if (!Util.isUnset(request.loadBalancing)) {
    query['LoadBalancing'] = request.loadBalancing;
  }
  if (!Util.isUnset(request.logHeaders)) {
    query['LogHeaders'] = request.logHeaders;
  }
  if (!Util.isUnset(request.readTime)) {
    query['ReadTime'] = request.readTime;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.retry)) {
    query['Retry'] = request.retry;
  }
  if (!Util.isUnset(request.sniHost)) {
    query['SniHost'] = request.sniHost;
  }
  if (!Util.isUnset(request.sniStatus)) {
    query['SniStatus'] = request.sniStatus;
  }
  if (!Util.isUnset(request.sourceIps)) {
    query['SourceIps'] = request.sourceIps;
  }
  if (!Util.isUnset(request.writeTime)) {
    query['WriteTime'] = request.writeTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDomain',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateDomainRequest
 * @return CreateDomainResponse
 */
async function createDomain(request: CreateDomainRequest): CreateDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDomainWithOptions(request, runtime);
}

model CreateProtectionModuleRuleRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='ac_custom'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
  rule?: string(name='Rule', description='This parameter is required.', example='{"action":"monitor","name":"test","scene":"custom_acl","conditions":[{"opCode":1,"key":"URL","values":"/example"}]}'),
}

model CreateProtectionModuleRuleResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model CreateProtectionModuleRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateProtectionModuleRuleResponseBody(name='body'),
}

/**
 * @param request CreateProtectionModuleRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateProtectionModuleRuleResponse
 */
async function createProtectionModuleRuleWithOptions(request: CreateProtectionModuleRuleRequest, runtime: Util.RuntimeOptions): CreateProtectionModuleRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.rule)) {
    query['Rule'] = request.rule;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateProtectionModuleRule',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateProtectionModuleRuleRequest
 * @return CreateProtectionModuleRuleResponse
 */
async function createProtectionModuleRule(request: CreateProtectionModuleRuleRequest): CreateProtectionModuleRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createProtectionModuleRuleWithOptions(request, runtime);
}

model DeleteDomainRequest {
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DeleteDomainResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DeleteDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDomainResponseBody(name='body'),
}

/**
 * @param request DeleteDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDomainResponse
 */
async function deleteDomainWithOptions(request: DeleteDomainRequest, runtime: Util.RuntimeOptions): DeleteDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDomain',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteDomainRequest
 * @return DeleteDomainResponse
 */
async function deleteDomain(request: DeleteDomainRequest): DeleteDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDomainWithOptions(request, runtime);
}

model DeleteInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-atstuj3rtop****'),
}

model DeleteInstanceResponseBody = {
  requestId?: string(name='RequestId', example='F35F45B0-5D6B-4238-BE02-A62D0760E840'),
}

model DeleteInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceResponseBody(name='body'),
}

/**
 * @param request DeleteInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceResponse
 */
async function deleteInstanceWithOptions(request: DeleteInstanceRequest, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteInstanceRequest
 * @return DeleteInstanceResponse
 */
async function deleteInstance(request: DeleteInstanceRequest): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInstanceWithOptions(request, runtime);
}

model DeleteProtectionModuleRuleRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='ac_custom'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-mp9153****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
  ruleId?: long(name='RuleId', description='This parameter is required.', example='42754'),
}

model DeleteProtectionModuleRuleResponseBody = {
  requestId?: string(name='RequestId', example='1557B42F-B889-460A-B17F-1DE5C5AD7FF2'),
}

model DeleteProtectionModuleRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteProtectionModuleRuleResponseBody(name='body'),
}

/**
 * @param request DeleteProtectionModuleRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteProtectionModuleRuleResponse
 */
async function deleteProtectionModuleRuleWithOptions(request: DeleteProtectionModuleRuleRequest, runtime: Util.RuntimeOptions): DeleteProtectionModuleRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteProtectionModuleRule',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteProtectionModuleRuleRequest
 * @return DeleteProtectionModuleRuleResponse
 */
async function deleteProtectionModuleRule(request: DeleteProtectionModuleRuleRequest): DeleteProtectionModuleRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteProtectionModuleRuleWithOptions(request, runtime);
}

model DescribeCertMatchStatusRequest {
  certificate?: string(name='Certificate', description='This parameter is required.', example='-----BEGIN CERTIFICATE----- 62EcYPWd2Oy1vs6MTXcJSfN9Z7rZ9fmxWr2BFN2XbahgnsSXM48ixZJ4krc+1M+j2kcubVpsE2cgHdj4v8H6jUz9Ji4mr7vMNS6dXv8PUkl/qoDeNGCNdyTS5NIL5ir+g92cL8IGOkjgvhlqt9vc65Cgb4mL+n5+DV9uOyTZTW/MojmlgfUekC2xiXa54nxJf17Y1TADGSbyJbsC0Q9nIrHsPl8YKkvRWvIAqYxXZ7wRwWWmv4TMxFhWRiNY7yZIo2ZUhl02SIDNggIEeg== -----END CERTIFICATE-----'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  privateKey?: string(name='PrivateKey', description='This parameter is required.', example='-----BEGIN RSA PRIVATE KEY----- DADTPZoOHd9WtZ3UKHJTRgNQmioPQn2bqdKHop+B/dn/4VZL7Jt8zSDGM9sTMThLyvsmLQKBgQCr+ujntC1kN6pGBj2Fw2l/EA/W3rYEce2tyhjgmG7rZ+A/jVE9fld5sQra6ZdwBcQJaiygoIYoaMF2EjRwc0qwHaluq0C15f6ujSoHh2e+D5zdmkTg/3NKNjqNv6xA2gYpinVDzFdZ9Zujxvuh9o4Vqf0YF8bv5UK5G04RtKadOw== -----END RSA PRIVATE KEY-----'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DescribeCertMatchStatusResponseBody = {
  matchStatus?: boolean(name='MatchStatus', example='false'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeCertMatchStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCertMatchStatusResponseBody(name='body'),
}

/**
 * @param request DescribeCertMatchStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCertMatchStatusResponse
 */
async function describeCertMatchStatusWithOptions(request: DescribeCertMatchStatusRequest, runtime: Util.RuntimeOptions): DescribeCertMatchStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.certificate)) {
    query['Certificate'] = request.certificate;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.privateKey)) {
    query['PrivateKey'] = request.privateKey;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCertMatchStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeCertMatchStatusRequest
 * @return DescribeCertMatchStatusResponse
 */
async function describeCertMatchStatus(request: DescribeCertMatchStatusRequest): DescribeCertMatchStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCertMatchStatusWithOptions(request, runtime);
}

model DescribeCertificatesRequest {
  domain?: string(name='Domain', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-zz11sr5****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DescribeCertificatesResponseBody = {
  certificates?: [ 
    {
      certificateId?: long(name='CertificateId', example='2329260'),
      certificateName?: string(name='CertificateName', example='*.aliyundoc.com'),
      commonName?: string(name='CommonName', example='*.aliyundoc.com'),
      endTime?: long(name='EndTime'),
      isUsing?: boolean(name='IsUsing', example='false'),
      sans?: [ string ](name='Sans'),
    }
  ](name='Certificates'),
  requestId?: string(name='RequestId', example='ECF65091-3704-55D5-BC88-EC208B0E238C'),
}

model DescribeCertificatesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCertificatesResponseBody(name='body'),
}

/**
 * @param request DescribeCertificatesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCertificatesResponse
 */
async function describeCertificatesWithOptions(request: DescribeCertificatesRequest, runtime: Util.RuntimeOptions): DescribeCertificatesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCertificates',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeCertificatesRequest
 * @return DescribeCertificatesResponse
 */
async function describeCertificates(request: DescribeCertificatesRequest): DescribeCertificatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCertificatesWithOptions(request, runtime);
}

model DescribeDomainRequest {
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-7pp26f1****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DescribeDomainResponseBody = {
  domain?: {
    accessHeaderMode?: int32(name='AccessHeaderMode', example='1'),
    accessHeaders?: [ string ](name='AccessHeaders'),
    accessType?: string(name='AccessType', example='waf-cloud-dns'),
    cloudNativeInstances?: [ 
      {
        cloudNativeProductName?: string(name='CloudNativeProductName', example='ALB'),
        IPAddressList?: [ string ](name='IPAddressList', example='["39.XX.XX.197"]'),
        instanceId?: string(name='InstanceId', example='alb-s65nua68wdedsp****'),
        protocolPortConfigs?: [ 
          {
            ports?: [ int32 ](name='Ports', example='[80]'),
            protocol?: string(name='Protocol', example='http'),
          }
        ](name='ProtocolPortConfigs'),
        redirectionTypeName?: string(name='RedirectionTypeName', example='ALB'),
      }
    ](name='CloudNativeInstances'),
    clusterType?: int32(name='ClusterType', example='0'),
    cname?: string(name='Cname', example='kdmqyi3ck7xogegxpiyfpb0fj21mgkxn.****.com'),
    connectionTime?: int32(name='ConnectionTime', example='5'),
    http2Port?: [ int32 ](name='Http2Port'),
    httpPort?: [ int32 ](name='HttpPort'),
    httpToUserIp?: int32(name='HttpToUserIp', example='0'),
    httpsPort?: [ int32 ](name='HttpsPort'),
    httpsRedirect?: int32(name='HttpsRedirect', example='0'),
    ipFollowStatus?: int32(name='IpFollowStatus', example='1'),
    isAccessProduct?: int32(name='IsAccessProduct', example='1'),
    keepalive?: boolean(name='Keepalive'),
    keepaliveRequests?: int32(name='KeepaliveRequests'),
    keepaliveTimeout?: int32(name='KeepaliveTimeout'),
    loadBalancing?: int32(name='LoadBalancing', example='2'),
    logHeaders?: [ 
      {
        k?: string(name='k', example='ALIWAF-TAG'),
        v?: string(name='v', example='Yes'),
      }
    ](name='LogHeaders'),
    readTime?: int32(name='ReadTime', example='120'),
    resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2mkrunv****'),
    retry?: boolean(name='Retry'),
    sniHost?: string(name='SniHost', example='waf.example.com'),
    sniStatus?: int32(name='SniStatus', example='1'),
    sourceIps?: [ string ](name='SourceIps'),
    version?: long(name='Version', example='40'),
    writeTime?: int32(name='WriteTime', example='120'),
  }(name='Domain'),
  requestId?: string(name='RequestId', example='D827FCFE-90A7-4330-9326-D33C8B4C7726'),
}

model DescribeDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainResponseBody(name='body'),
}

/**
 * @param request DescribeDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainResponse
 */
async function describeDomainWithOptions(request: DescribeDomainRequest, runtime: Util.RuntimeOptions): DescribeDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomain',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDomainRequest
 * @return DescribeDomainResponse
 */
async function describeDomain(request: DescribeDomainRequest): DescribeDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainWithOptions(request, runtime);
}

model DescribeDomainAdvanceConfigsRequest {
  domainList?: string(name='DomainList', description='This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-2r427ng****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-atstuj3rtop****'),
}

model DescribeDomainAdvanceConfigsResponseBody = {
  domainConfigs?: [ 
    {
      domain?: string(name='Domain', example='www.aliyundoc.com'),
      profile?: {
        certStatus?: int32(name='CertStatus', example='1'),
        clusterType?: int32(name='ClusterType', example='0'),
        cname?: string(name='Cname', example='****dsbpkt75zeiok5mta2j5l7hggcrm.****.com'),
        exclusiveVipStatus?: int32(name='ExclusiveVipStatus', example='0'),
        GSLBStatus?: string(name='GSLBStatus', example='on'),
        http2Port?: [ int32 ](name='Http2Port'),
        httpPort?: [ int32 ](name='HttpPort'),
        httpsPort?: [ int32 ](name='HttpsPort'),
        ipv6Status?: int32(name='Ipv6Status', example='1'),
        resolvedType?: int32(name='ResolvedType', example='0'),
        rs?: [ string ](name='Rs', example='["39.XX.XX.197"]'),
        vipServiceStatus?: int32(name='VipServiceStatus', example='0'),
      }(name='Profile'),
    }
  ](name='DomainConfigs'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeDomainAdvanceConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainAdvanceConfigsResponseBody(name='body'),
}

/**
 * @param request DescribeDomainAdvanceConfigsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainAdvanceConfigsResponse
 */
async function describeDomainAdvanceConfigsWithOptions(request: DescribeDomainAdvanceConfigsRequest, runtime: Util.RuntimeOptions): DescribeDomainAdvanceConfigsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainList)) {
    query['DomainList'] = request.domainList;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomainAdvanceConfigs',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDomainAdvanceConfigsRequest
 * @return DescribeDomainAdvanceConfigsResponse
 */
async function describeDomainAdvanceConfigs(request: DescribeDomainAdvanceConfigsRequest): DescribeDomainAdvanceConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainAdvanceConfigsWithOptions(request, runtime);
}

model DescribeDomainBasicConfigsRequest {
  accessType?: string(name='AccessType', example='waf-cloud-dns'),
  cloudNativeProductId?: int32(name='CloudNativeProductId', example='0'),
  domainKey?: string(name='DomainKey', example='aliyundoc'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-tl32ast****'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2pz25js****'),
}

model DescribeDomainBasicConfigsResponseBody = {
  domainConfigs?: [ 
    {
      accessType?: string(name='AccessType', example='waf-cloud-dns'),
      aclStatus?: int32(name='AclStatus', example='1'),
      ccMode?: int32(name='CcMode', example='0'),
      ccStatus?: int32(name='CcStatus', example='1'),
      domain?: string(name='Domain', example='www.aliyundoc.com'),
      owner?: string(name='Owner', example='WAF'),
      status?: int32(name='Status', example='1'),
      version?: long(name='Version', example='0'),
      wafMode?: int32(name='WafMode', example='0'),
      wafStatus?: int32(name='WafStatus', example='1'),
    }
  ](name='DomainConfigs'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  totalCount?: int32(name='TotalCount', example='1'),
}

model DescribeDomainBasicConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainBasicConfigsResponseBody(name='body'),
}

/**
 * @param request DescribeDomainBasicConfigsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainBasicConfigsResponse
 */
async function describeDomainBasicConfigsWithOptions(request: DescribeDomainBasicConfigsRequest, runtime: Util.RuntimeOptions): DescribeDomainBasicConfigsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessType)) {
    query['AccessType'] = request.accessType;
  }
  if (!Util.isUnset(request.cloudNativeProductId)) {
    query['CloudNativeProductId'] = request.cloudNativeProductId;
  }
  if (!Util.isUnset(request.domainKey)) {
    query['DomainKey'] = request.domainKey;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomainBasicConfigs',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDomainBasicConfigsRequest
 * @return DescribeDomainBasicConfigsResponse
 */
async function describeDomainBasicConfigs(request: DescribeDomainBasicConfigsRequest): DescribeDomainBasicConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainBasicConfigsWithOptions(request, runtime);
}

model DescribeDomainListRequest {
  domainName?: string(name='DomainName', example='example.com'),
  domainNames?: [ string ](name='DomainNames', example='example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-7pp26f1****'),
  isSub?: int32(name='IsSub', example='0'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2pz25js****'),
}

model DescribeDomainListResponseBody = {
  domainNames?: [ string ](name='DomainNames'),
  requestId?: string(name='RequestId', example='592E866F-6C05-4E7C-81DE-B4D8E86B91EF'),
  totalCount?: int32(name='TotalCount', example='2'),
}

model DescribeDomainListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainListResponseBody(name='body'),
}

/**
 * @param request DescribeDomainListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainListResponse
 */
async function describeDomainListWithOptions(request: DescribeDomainListRequest, runtime: Util.RuntimeOptions): DescribeDomainListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainName)) {
    query['DomainName'] = request.domainName;
  }
  if (!Util.isUnset(request.domainNames)) {
    query['DomainNames'] = request.domainNames;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isSub)) {
    query['IsSub'] = request.isSub;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomainList',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDomainListRequest
 * @return DescribeDomainListResponse
 */
async function describeDomainList(request: DescribeDomainListRequest): DescribeDomainListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainListWithOptions(request, runtime);
}

model DescribeDomainNamesRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-atstuj3rtop****'),
}

model DescribeDomainNamesResponseBody = {
  domainNames?: [ string ](name='DomainNames'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeDomainNamesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainNamesResponseBody(name='body'),
}

/**
 * @param request DescribeDomainNamesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainNamesResponse
 */
async function describeDomainNamesWithOptions(request: DescribeDomainNamesRequest, runtime: Util.RuntimeOptions): DescribeDomainNamesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomainNames',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDomainNamesRequest
 * @return DescribeDomainNamesResponse
 */
async function describeDomainNames(request: DescribeDomainNamesRequest): DescribeDomainNamesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainNamesWithOptions(request, runtime);
}

model DescribeDomainRuleGroupRequest {
  domain?: string(name='Domain', description='This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DescribeDomainRuleGroupResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  ruleGroupId?: long(name='RuleGroupId', example='1012'),
  wafAiStatus?: int32(name='WafAiStatus', example='1'),
}

model DescribeDomainRuleGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainRuleGroupResponseBody(name='body'),
}

/**
 * @param request DescribeDomainRuleGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainRuleGroupResponse
 */
async function describeDomainRuleGroupWithOptions(request: DescribeDomainRuleGroupRequest, runtime: Util.RuntimeOptions): DescribeDomainRuleGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomainRuleGroup',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDomainRuleGroupRequest
 * @return DescribeDomainRuleGroupResponse
 */
async function describeDomainRuleGroup(request: DescribeDomainRuleGroupRequest): DescribeDomainRuleGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainRuleGroupWithOptions(request, runtime);
}

model DescribeInstanceInfoRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

If you do not configure this parameter, all WAF instances in the Chinese mainland or all WAF instances outside the Chinese mainland are queried.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the WAF instance belongs in Resource Management. If you do not configure this parameter, the WAF instance belongs to the default resource group.', example='rg-atstuj3rtop****'),
}

model DescribeInstanceInfoResponseBody = {
  instanceInfo?: {
    endDate?: long(name='EndDate', description='The expiration time of the WAF instance. This value is a UNIX timestamp. Unit: seconds.

>  If the value of **PayType** is **0**, this parameter is not returned. The value 0 indicates that no WAF instances are purchased.', example='1512921600'),
    inDebt?: int32(name='InDebt', description='Indicates whether the WAF instance has overdue payments. Valid values:

*   **0**: The instance has overdue payments.
*   **1**: The instance does not have overdue payments.

>  If the value of **PayType** is **0**, this parameter is not returned. The value 0 indicates that no WAF instances are purchased.', example='1'),
    instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  If the value of **PayType** is **0**, this parameter is not returned. The value 0 indicates that no WAF instances are purchased.', example='waf-cn-tl32ast****'),
    payType?: int32(name='PayType', description='The activation status of WAF. Valid values:

*   **0**: No WAF instances are purchased within the Alibaba Cloud account.
*   **1**: A subscription WAF instance is purchased within the Alibaba Cloud account.', example='1'),
    region?: string(name='Region', description='The region in which the WAF instance resides. Valid values:

*   **cn**: a region in the Chinese mainland
*   **cn-hongkong**: a region outside the Chinese mainland

>  If the value of **PayType** is **0**, this parameter is not returned. The value 0 indicates that no WAF instances are purchased.', example='cn'),
    remainDay?: int32(name='RemainDay', description='The number of remaining days before the trial period of the WAF instance ends.

>  This parameter is returned only if the value of **Trial** is **1**. The value 1 indicates that the free trial of a WAF instance is activated.', example='1'),
    status?: int32(name='Status', description='Indicates whether the WAF instance expires. Valid values:

*   **0**: The instance expires.
*   **1**: The instance does not expire.

>  If the value of **PayType** is **0**, this parameter is not returned. The value 0 indicates that no WAF instances are purchased.', example='1'),
    subscriptionType?: string(name='SubscriptionType', description='The billing method of the WAF instance: The value is fixed as **Subscription**.

>  If the value of **PayType** is **0**, this parameter is not returned. The value 0 indicates that no WAF instances are purchased.', example='Subscription'),
    trial?: int32(name='Trial', description='Indicates whether a WAF instance of the free trial edition is activated within the Alibaba Cloud account. Valid values:

*   **0**: no
*   **1**: yes

>  This parameter is returned only if a WAF instance of the free trial edition is activated within the Alibaba Cloud account.', example='1'),
    version?: string(name='Version', description='The edition of the WAF instance. Valid values:

*   **version_pro_china**: a WAF Pro instance in the Chinese mainland
*   **version_business_china**: a WAF Business instance in the Chinese mainland
*   **version_enterprise_china**: a WAF Enterprise instance in the Chinese mainland
*   **version_exclusive_china**: a WAF Exclusive instance in the Chinese mainland
*   **version_hybrid_cloud_standard_china**: a Hybrid Cloud WAF instance in the Chinese mainland
*   **version_pro_china**: a WAF Pro instance outside the Chinese mainland
*   **version_business**: a WAF Business instance outside the Chinese mainland
*   **version_enterprise**: a WAF Enterprise instance outside the Chinese mainland
*   **version_exclusive**: a WAF Exclusive instance outside the Chinese mainland
*   **version_hybrid_cloud_standard**: a Hybrid Cloud WAF instance outside the Chinese mainland

The preceding list contains all the editions of WAF instances within accounts that are created at the International site. If the returned version is not in the list, check whether your account is created at the International site.

>  If the value of **PayType** is **0**, this parameter is not returned. The value 0 indicates that no WAF instances are purchased.', example='version_3'),
  }(name='InstanceInfo', description='The information about the WAF instance.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeInstanceInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceInfoResponseBody(name='body'),
}

/**
 * @description ## Usage notes
 * You can call the DescribeInstanceInfo operation to query the information about the WAF instance within your Alibaba Cloud account. The information includes the ID, version, status, and expiration time of the instance.
 *
 * @param request DescribeInstanceInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceInfoResponse
 */
async function describeInstanceInfoWithOptions(request: DescribeInstanceInfoRequest, runtime: Util.RuntimeOptions): DescribeInstanceInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceInfo',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @description ## Usage notes
 * You can call the DescribeInstanceInfo operation to query the information about the WAF instance within your Alibaba Cloud account. The information includes the ID, version, status, and expiration time of the instance.
 *
 * @param request DescribeInstanceInfoRequest
 * @return DescribeInstanceInfoResponse
 */
async function describeInstanceInfo(request: DescribeInstanceInfoRequest): DescribeInstanceInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceInfoWithOptions(request, runtime);
}

model DescribeInstanceSpecInfoRequest {
  instanceId?: string(name='InstanceId', example='waf-cn-st2225l****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-atstuj3rtop****'),
}

model DescribeInstanceSpecInfoResponseBody = {
  expireTime?: long(name='ExpireTime', example='1677168000000'),
  instanceId?: string(name='InstanceId', example='waf-cn-st2225l****'),
  instanceSpecInfos?: [ 
    {
      code?: string(name='Code', example='103'),
      value?: string(name='Value'),
    }
  ](name='InstanceSpecInfos'),
  requestId?: string(name='RequestId', example='E906513E-F6B5-495E-98DC-7BA888671D76'),
  version?: string(name='Version'),
}

model DescribeInstanceSpecInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceSpecInfoResponseBody(name='body'),
}

/**
 * @param request DescribeInstanceSpecInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceSpecInfoResponse
 */
async function describeInstanceSpecInfoWithOptions(request: DescribeInstanceSpecInfoRequest, runtime: Util.RuntimeOptions): DescribeInstanceSpecInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceSpecInfo',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeInstanceSpecInfoRequest
 * @return DescribeInstanceSpecInfoResponse
 */
async function describeInstanceSpecInfo(request: DescribeInstanceSpecInfoRequest): DescribeInstanceSpecInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceSpecInfoWithOptions(request, runtime);
}

model DescribeLogServiceStatusRequest {
  domainNames?: [ string ](name='DomainNames', example='www.aliyun.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-zz11sr5****'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  region?: string(name='Region', example='cn'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2pz25js****'),
}

model DescribeLogServiceStatusResponseBody = {
  domainStatus?: [ 
    {
      domain?: string(name='Domain', example='www.aliyun.com'),
      slsLogActive?: int32(name='SlsLogActive', example='1'),
    }
  ](name='DomainStatus'),
  requestId?: string(name='RequestId', example='C2E97B3F-1623-4CDF-A7E2-FD9D4CF1027A'),
  totalCount?: int32(name='TotalCount', example='1'),
}

model DescribeLogServiceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeLogServiceStatusResponseBody(name='body'),
}

/**
 * @param request DescribeLogServiceStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeLogServiceStatusResponse
 */
async function describeLogServiceStatusWithOptions(request: DescribeLogServiceStatusRequest, runtime: Util.RuntimeOptions): DescribeLogServiceStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainNames)) {
    query['DomainNames'] = request.domainNames;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLogServiceStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeLogServiceStatusRequest
 * @return DescribeLogServiceStatusResponse
 */
async function describeLogServiceStatus(request: DescribeLogServiceStatusRequest): DescribeLogServiceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLogServiceStatusWithOptions(request, runtime);
}

model DescribeProtectionModuleCodeConfigRequest {
  codeType?: int32(name='CodeType', description='This parameter is required.', example='14'),
  codeValue?: int32(name='CodeValue', example='0'),
  instanceId?: string(name='InstanceId', description='This parameter is required.'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2pz25js****'),
}

model DescribeProtectionModuleCodeConfigResponseBody = {
  codeConfigs?: string(name='CodeConfigs', example='[{"code":0,"name":"310000,530000,150000,110000,TW_01,220000,510000,120000,640000,340000,370000,140000,440000,450000,650000,320000,360000,130000,410000,330000,460000,420000,430000,MO_01,620000,350000,540000,520000,210000,500000,610000,630000,HK_01,230000","env":"online"}]'),
  requestId?: string(name='RequestId', example='BE3911B8-9D96-5B39-8875-503BBC9DA4BF'),
}

model DescribeProtectionModuleCodeConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeProtectionModuleCodeConfigResponseBody(name='body'),
}

/**
 * @param request DescribeProtectionModuleCodeConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeProtectionModuleCodeConfigResponse
 */
async function describeProtectionModuleCodeConfigWithOptions(request: DescribeProtectionModuleCodeConfigRequest, runtime: Util.RuntimeOptions): DescribeProtectionModuleCodeConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.codeType)) {
    query['CodeType'] = request.codeType;
  }
  if (!Util.isUnset(request.codeValue)) {
    query['CodeValue'] = request.codeValue;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeProtectionModuleCodeConfig',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeProtectionModuleCodeConfigRequest
 * @return DescribeProtectionModuleCodeConfigResponse
 */
async function describeProtectionModuleCodeConfig(request: DescribeProtectionModuleCodeConfigRequest): DescribeProtectionModuleCodeConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeProtectionModuleCodeConfigWithOptions(request, runtime);
}

model DescribeProtectionModuleModeRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='waf'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-atstuj3rtop****'),
}

model DescribeProtectionModuleModeResponseBody = {
  mode?: int32(name='Mode', example='1'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeProtectionModuleModeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeProtectionModuleModeResponseBody(name='body'),
}

/**
 * @param request DescribeProtectionModuleModeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeProtectionModuleModeResponse
 */
async function describeProtectionModuleModeWithOptions(request: DescribeProtectionModuleModeRequest, runtime: Util.RuntimeOptions): DescribeProtectionModuleModeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeProtectionModuleMode',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeProtectionModuleModeRequest
 * @return DescribeProtectionModuleModeResponse
 */
async function describeProtectionModuleMode(request: DescribeProtectionModuleModeRequest): DescribeProtectionModuleModeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeProtectionModuleModeWithOptions(request, runtime);
}

model DescribeProtectionModuleRulesRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='ac_highfreq'),
  domain?: string(name='Domain', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  lang?: string(name='Lang', example='zh'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  query?: string(name='Query', example='e2ZpbHRlcjp7InJ1bGVJZCI6NDI3NTV9LG9yZGVyQnk6ImdtdF9tb2RpZmllZCIsZGVzYzp0cnVlfQ=='),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2pz25js****'),
}

model DescribeProtectionModuleRulesResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  rules?: [ 
    {
      content?: map[string]any(name='Content', example='{"count":60,"interval":60,"ttl":300}'),
      ruleId?: long(name='RuleId', example='42755'),
      status?: long(name='Status', example='1'),
      time?: long(name='Time', example='1570700044'),
      version?: long(name='Version', example='2'),
    }
  ](name='Rules'),
  totalCount?: int32(name='TotalCount', example='1'),
}

model DescribeProtectionModuleRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeProtectionModuleRulesResponseBody(name='body'),
}

/**
 * @param request DescribeProtectionModuleRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeProtectionModuleRulesResponse
 */
async function describeProtectionModuleRulesWithOptions(request: DescribeProtectionModuleRulesRequest, runtime: Util.RuntimeOptions): DescribeProtectionModuleRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.query)) {
    query['Query'] = request.query;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeProtectionModuleRules',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeProtectionModuleRulesRequest
 * @return DescribeProtectionModuleRulesResponse
 */
async function describeProtectionModuleRules(request: DescribeProtectionModuleRulesRequest): DescribeProtectionModuleRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeProtectionModuleRulesWithOptions(request, runtime);
}

model DescribeProtectionModuleStatusRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='waf'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-zz11sr5****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DescribeProtectionModuleStatusResponseBody = {
  moduleStatus?: int32(name='ModuleStatus', example='1'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeProtectionModuleStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeProtectionModuleStatusResponseBody(name='body'),
}

/**
 * @param request DescribeProtectionModuleStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeProtectionModuleStatusResponse
 */
async function describeProtectionModuleStatusWithOptions(request: DescribeProtectionModuleStatusRequest, runtime: Util.RuntimeOptions): DescribeProtectionModuleStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeProtectionModuleStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeProtectionModuleStatusRequest
 * @return DescribeProtectionModuleStatusResponse
 */
async function describeProtectionModuleStatus(request: DescribeProtectionModuleStatusRequest): DescribeProtectionModuleStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeProtectionModuleStatusWithOptions(request, runtime);
}

model DescribeRuleGroupsRequest {
  currentPage?: int32(name='CurrentPage', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_cdnsdf3****'),
  lang?: string(name='Lang', example='zh'),
  pageSize?: int32(name='PageSize', example='10'),
  policyId?: long(name='PolicyId', example='1011'),
  region?: string(name='Region', example='cn'),
  regionId?: string(name='RegionId', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-aek23puu7m3kmea'),
  sourceIp?: string(name='SourceIp', example='60.208.111.213'),
  type?: int32(name='Type', example='10'),
  wafLang?: string(name='WafLang', example='ZH'),
}

model DescribeRuleGroupsResponseBody = {
  requestId?: string(name='RequestId', example='02E9A4B8-90FB-5F41-A049-C82277EB82FB'),
  ruleGroups?: [ 
    {
      desc?: string(name='Desc', example='desc'),
      domainList?: [ string ](name='DomainList'),
      name?: string(name='Name', example='rule_group_test'),
      policyId?: long(name='PolicyId', example='116562'),
      ruleCnt?: int32(name='RuleCnt', example='1'),
      ruleGroupTemplateName?: string(name='RuleGroupTemplateName', example='rule_group_test'),
      ruleGroupUpdateTime?: long(name='RuleGroupUpdateTime', example='1711445265'),
      templatePolicyId?: long(name='TemplatePolicyId', example='1102'),
      type?: int32(name='Type', example='1'),
      wafVersion?: long(name='WafVersion', example='11'),
    }
  ](name='RuleGroups'),
  taskStatus?: int32(name='TaskStatus', example='2'),
  total?: int32(name='Total', example='1'),
  wafTaskId?: string(name='WafTaskId', example='123'),
}

model DescribeRuleGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleGroupsResponseBody(name='body'),
}

/**
 * @param request DescribeRuleGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleGroupsResponse
 */
async function describeRuleGroupsWithOptions(request: DescribeRuleGroupsRequest, runtime: Util.RuntimeOptions): DescribeRuleGroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  if (!Util.isUnset(request.wafLang)) {
    query['WafLang'] = request.wafLang;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRuleGroups',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeRuleGroupsRequest
 * @return DescribeRuleGroupsResponse
 */
async function describeRuleGroups(request: DescribeRuleGroupsRequest): DescribeRuleGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRuleGroupsWithOptions(request, runtime);
}

model DescribeRulesRequest {
  applicationType?: int32(name='ApplicationType', example='0'),
  cveIdKey?: string(name='CveIdKey', description='CVE ID', example='CVE-*-*5'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-*'),
  lang?: string(name='Lang', example='zh'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  protectionType?: int32(name='ProtectionType', example='11'),
  region?: string(name='Region', example='cn'),
  regionId?: string(name='RegionId', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-*'),
  riskLevel?: int32(name='RiskLevel', example='0'),
  ruleGroupId?: long(name='RuleGroupId', description='This parameter is required.', example='1012'),
  ruleIdKey?: string(name='RuleIdKey', example='1131*0'),
  sourceIp?: string(name='SourceIp', example='42.84.*.*'),
}

model DescribeRulesResponseBody = {
  isSubscribe?: long(name='IsSubscribe', example='1'),
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-*'),
  ruleGroupName?: string(name='RuleGroupName', example='test111'),
  ruleGroupTemplateId?: string(name='RuleGroupTemplateId', example='1012'),
  ruleGroupTemplateName?: string(name='RuleGroupTemplateName', example='rule_group_test'),
  rules?: [ 
    {
      applicationType?: int32(name='ApplicationType', example='15'),
      cveId?: string(name='CveId', description='CVE ID。', example='CVE-2021-*'),
      cveUrl?: string(name='CveUrl'),
      description?: string(name='Description'),
      protectionType?: int32(name='ProtectionType', example='11'),
      riskLevel?: int32(name='RiskLevel', example='0'),
      ruleId?: long(name='RuleId', example='42755'),
      ruleName?: string(name='RuleName', example='rules_41'),
      updateTime?: long(name='UpdateTime', example='1684120148.0'),
    }
  ](name='Rules'),
  totalCount?: int32(name='TotalCount', example='1'),
}

model DescribeRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRulesResponseBody(name='body'),
}

/**
 * @param request DescribeRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRulesResponse
 */
async function describeRulesWithOptions(request: DescribeRulesRequest, runtime: Util.RuntimeOptions): DescribeRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationType)) {
    query['ApplicationType'] = request.applicationType;
  }
  if (!Util.isUnset(request.cveIdKey)) {
    query['CveIdKey'] = request.cveIdKey;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.protectionType)) {
    query['ProtectionType'] = request.protectionType;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.riskLevel)) {
    query['RiskLevel'] = request.riskLevel;
  }
  if (!Util.isUnset(request.ruleGroupId)) {
    query['RuleGroupId'] = request.ruleGroupId;
  }
  if (!Util.isUnset(request.ruleIdKey)) {
    query['RuleIdKey'] = request.ruleIdKey;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRules',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeRulesRequest
 * @return DescribeRulesResponse
 */
async function describeRules(request: DescribeRulesRequest): DescribeRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRulesWithOptions(request, runtime);
}

model DescribeWafSourceIpSegmentRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-zz11sr5****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2pz25js****'),
}

model DescribeWafSourceIpSegmentResponseBody = {
  ipV6s?: string(name='IpV6s', example='39.XXX.XXX.0/24,……,2408:400a:XXXX:XXXX::/56'),
  ips?: string(name='Ips', example='47.XXX.XXX.192/26,……,47.XXX.XXX.0/24'),
  requestId?: string(name='RequestId', example='AB2F5E31-EE96-4FD7-9560-45FF5D5377FF'),
}

model DescribeWafSourceIpSegmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeWafSourceIpSegmentResponseBody(name='body'),
}

/**
 * @param request DescribeWafSourceIpSegmentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeWafSourceIpSegmentResponse
 */
async function describeWafSourceIpSegmentWithOptions(request: DescribeWafSourceIpSegmentRequest, runtime: Util.RuntimeOptions): DescribeWafSourceIpSegmentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeWafSourceIpSegment',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeWafSourceIpSegmentRequest
 * @return DescribeWafSourceIpSegmentResponse
 */
async function describeWafSourceIpSegment(request: DescribeWafSourceIpSegmentRequest): DescribeWafSourceIpSegmentResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeWafSourceIpSegmentWithOptions(request, runtime);
}

model ModifyDomainRequest {
  accessHeaderMode?: int32(name='AccessHeaderMode', description='The method that WAF uses to obtain the actual IP address of a client. Valid values:

*   **0**: WAF reads the first value of the X-Forwarded-For (XFF) header field as the actual IP address of the client. This is the default value.
*   **1**: WAF reads the value of a custom header field as the actual IP address of the client.

>  You need to specify the parameter only when the **IsAccessProduct** parameter is set to **1**.', example='0'),
  accessHeaders?: string(name='AccessHeaders', description='The custom header fields that are used to obtain the actual IP address of a client. Specify the value in the `["header1","header2",...]` format.

>  You need to specify the parameter only when the **AccessHeaderMode** parameter is set to **1**.', example='["X-Client-IP"]'),
  accessType?: string(name='AccessType', description='The mode that is used to add the domain name. Valid values:

*   **waf-cloud-dns**: CNAME record mode. This is the default value.
*   **waf-cloud-native**: transparent proxy mode.', example='waf-cloud-dns'),
  cloudNativeInstances?: string(name='CloudNativeInstances', description='The list of server and port configurations for the transparent proxy mode. The value is a string that consists of JSON arrays. Each element in a JSON array is a JSON struct that contains the following fields:

*   **ProtocolPortConfigs**: the list of protocol and port configurations. This field is required. Data type: array. Each element in a JSON array is a JSON struct that contains the following fields:

    *   **Ports**: the list of ports. This field is required. Data type: array. The value is in the `[port1,port2,……]` format.
    *   **Protocol**: the protocol. This field is required. Data type: string. Valid values: **http** and **https**.

*   **CloudNativeProductName**: the type of the cloud service instance. This field is required. Data type: string. Valid values: **ECS**, **SLB**, and **ALB**.

*   **RedirectionTypeName**: the type of traffic redirection port. This field is required. Data type: string. Valid values: **ECS**, **SLB-L4**, **SLB-L7**, and **ALB**.

*   **InstanceId**: the ID of the cloud service instance. This field is required. Data type: string.

*   **IPAddressList**: the list of public IP addresses of the cloud service instance. This field is required. Data type: array. The value is in the `["ip1","ip2",...]` format.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-native**.', example='[{"ProtocolPortConfigs":[{"Ports":[80],"Protocol":"http"}],"RedirectionTypeName":"ALB","InstanceId":"alb-s65nua68wdedsp****","IPAddressList":["182.XX.XX.113"],"CloudNativeProductName":"ALB"}]'),
  clusterType?: int32(name='ClusterType', description='The type of WAF protection cluster. Valid values:

*   **0**: shared cluster. This is the default value.
*   **1**: exclusive cluster.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns**.', example='0'),
  connectionTime?: int32(name='ConnectionTime', description='The timeout period for connections of WAF exclusive clusters. Unit: seconds.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns** and the value of the **ClusterType** parameter is set to **1**.', example='5'),
  domain?: string(name='Domain', description='The domain name whose configurations you want to modify.

>  You can call the [DescribeDomainNames](https://help.aliyun.com/document_detail/86373.html) operation to query the domain names that are added to Web Application Firewall (WAF).

This parameter is required.', example='www.example.com'),
  http2Port?: string(name='Http2Port', description='The HTTP/2 ports. Specify the value in the `["port1","port2",...]` format.

>  You need to specify this parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns** and the **HttpsPort** parameter is not empty. If the HttpsPort parameter is not empty, your website uses HTTPS.', example='[443]'),
  httpPort?: string(name='HttpPort', description='The HTTP ports. Specify the value in the `["port1","port2",...]` format.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns**. If you specify this parameter, your website uses HTTP. You must specify at least one of the **HttpPort** and **HttpsPort** parameters.', example='[80]'),
  httpToUserIp?: int32(name='HttpToUserIp', description='Specifies whether to enable the feature of redirecting HTTPS requests to HTTP requests. If you enable the feature, HTTPS requests are redirected to HTTP requests on port 80, which is used by default. Valid values:

*   **0**: disables the feature. This is the default value.
*   **1**: enables the feature.

>  You need to specify this parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns** and the **HttpsPort** parameter is not empty. If the HttpsPort parameter is not empty, your website uses HTTPS.', example='0'),
  httpsPort?: string(name='HttpsPort', description='The HTTPS ports. Specify the value in the `["port1","port2",...]` format.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns**. If you specify this parameter, your website uses HTTPS. You must specify at least one of the **HttpPort** and **HttpsPort** parameters.', example='[443]'),
  httpsRedirect?: int32(name='HttpsRedirect', description='Specifies whether to enable the feature of redirecting HTTP requests to HTTPS requests. If you enable the feature, HTTP requests are redirected to HTTPS requests on port 443, which is used by default. Valid values:

*   **0**: disables the feature. This is the default value.
*   **1**: enables the feature.

>  You need to specify this parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns** and the **HttpsPort** parameter is not empty. If the HttpsPort parameter is not empty, your website uses HTTPS.', example='0'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-7pp26f1****'),
  ipFollowStatus?: int32(name='IpFollowStatus', description='Specifies whether to enable the feature of forwarding requests to the origin servers that use the IP address type specified in the requests. If you enable the feature, WAF forwards requests from IPv4 addresses to origin servers that use IPv4 addresses and requests from IPv6 addresses to origin servers that use IPv6 addresses. Valid values:

*   **0**: disables the feature. This is the default value.
*   **1**: enables the feature.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns**.', example='0'),
  isAccessProduct?: int32(name='IsAccessProduct', description='Specifies whether to deploy a Layer 7 proxy, which is used to filter inbound traffic before the traffic reaches the WAF instance. The supported Layer 7 proxies include Anti-DDoS Pro, Anti-DDoS Premium, and Alibaba Cloud CDN. Valid values:

*   **0**: does not configure a Layer 7 proxy
*   **1**: configures a Layer 7 proxy

This parameter is required.', example='0'),
  keepalive?: boolean(name='Keepalive', example='true'),
  keepaliveRequests?: int32(name='KeepaliveRequests', example='1000'),
  keepaliveTimeout?: int32(name='KeepaliveTimeout', example='60'),
  loadBalancing?: int32(name='LoadBalancing', description='The load balancing algorithm that is used when WAF forwards requests to the origin server. Valid values:

*   **0**: IP hash
*   **1**: round-robin
*   **2**: least time

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns**.', example='0'),
  logHeaders?: string(name='LogHeaders', description='The key-value pair that is used to mark the requests that pass through the WAF instance.

Specify the key-value pair in the `[{"k":"_key_","v":"_value_"}]` format. `_key_` specifies a header field in a custom request. `_value_` specifies the value of the field.

WAF automatically adds the key-value pair to the headers of requests. This way, the requests that pass through WAF are identified.

>  If requests contain the custom header field, WAF overwrites the original value of the field with the specified value.', example='[{"k":"ALIWAF-TAG","v":"Yes"}]'),
  readTime?: int32(name='ReadTime', description='The timeout period for read connections of WAF exclusive clusters. Unit: seconds.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns** and the value of the **ClusterType** parameter is set to **1**.', example='120'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-atstuj3rtop****'),
  retry?: boolean(name='Retry', example='true'),
  sniHost?: string(name='SniHost', description='The value of the custom SNI field. If this parameter is not specified, the value of the **Host** field in the request header is automatically used as the value of the SNI field.

If you want WAF to use an SNI field whose value is different from the value of the Host field, you can specify a custom value for the SNI field.

>  This parameter needs to be set only when the value of the **SniStatus** parameter is set to **1**.', example='waf.example.com'),
  sniStatus?: int32(name='SniStatus', description='Specifies whether to enable origin SNI. Origin Server Name Indication (SNI) specifies the domain name to which an HTTPS connection needs to be established at the start of the TLS handshaking process when WAF forwards requests to the origin server. If the origin server hosts multiple domain names, you must enable this feature. Valid values:

*   **0**: disables origin SNI.
*   **1**: enables origin SNI.

By default, origin SNI is disabled for WAF instances in the Chinese mainland and enabled for WAF instances outside the Chinese mainland.

>  You need to specify this parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns** and the **HttpsPort** parameter is not empty. If the HttpsPort parameter is not empty, your website uses HTTPS.', example='1'),
  sourceIps?: string(name='SourceIps', description='The address type of the origin server. The address can be an IP address or a domain name. You can specify only one type of address.

*   If you use the IP address type, specify the value in the `["ip1","ip2",...]` format. You can add up to 20 IP addresses.
*   If you use the domain name type, specify the value in the `["domain"]` format. You can enter only one domain name.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns**.', example='["39.XX.XX.197"]'),
  writeTime?: int32(name='WriteTime', description='The timeout period for write connections of WAF exclusive clusters. Unit: seconds.

>  You need to specify the parameter only when the value of the **AccessType** parameter is set to **waf-cloud-dns** and the value of the **ClusterType** parameter is set to **1**.', example='120'),
}

model ModifyDomainResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model ModifyDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDomainResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a domain name.
 *
 * @param request ModifyDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDomainResponse
 */
async function modifyDomainWithOptions(request: ModifyDomainRequest, runtime: Util.RuntimeOptions): ModifyDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessHeaderMode)) {
    query['AccessHeaderMode'] = request.accessHeaderMode;
  }
  if (!Util.isUnset(request.accessHeaders)) {
    query['AccessHeaders'] = request.accessHeaders;
  }
  if (!Util.isUnset(request.accessType)) {
    query['AccessType'] = request.accessType;
  }
  if (!Util.isUnset(request.cloudNativeInstances)) {
    query['CloudNativeInstances'] = request.cloudNativeInstances;
  }
  if (!Util.isUnset(request.clusterType)) {
    query['ClusterType'] = request.clusterType;
  }
  if (!Util.isUnset(request.connectionTime)) {
    query['ConnectionTime'] = request.connectionTime;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.http2Port)) {
    query['Http2Port'] = request.http2Port;
  }
  if (!Util.isUnset(request.httpPort)) {
    query['HttpPort'] = request.httpPort;
  }
  if (!Util.isUnset(request.httpToUserIp)) {
    query['HttpToUserIp'] = request.httpToUserIp;
  }
  if (!Util.isUnset(request.httpsPort)) {
    query['HttpsPort'] = request.httpsPort;
  }
  if (!Util.isUnset(request.httpsRedirect)) {
    query['HttpsRedirect'] = request.httpsRedirect;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ipFollowStatus)) {
    query['IpFollowStatus'] = request.ipFollowStatus;
  }
  if (!Util.isUnset(request.isAccessProduct)) {
    query['IsAccessProduct'] = request.isAccessProduct;
  }
  if (!Util.isUnset(request.keepalive)) {
    query['Keepalive'] = request.keepalive;
  }
  if (!Util.isUnset(request.keepaliveRequests)) {
    query['KeepaliveRequests'] = request.keepaliveRequests;
  }
  if (!Util.isUnset(request.keepaliveTimeout)) {
    query['KeepaliveTimeout'] = request.keepaliveTimeout;
  }
  if (!Util.isUnset(request.loadBalancing)) {
    query['LoadBalancing'] = request.loadBalancing;
  }
  if (!Util.isUnset(request.logHeaders)) {
    query['LogHeaders'] = request.logHeaders;
  }
  if (!Util.isUnset(request.readTime)) {
    query['ReadTime'] = request.readTime;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.retry)) {
    query['Retry'] = request.retry;
  }
  if (!Util.isUnset(request.sniHost)) {
    query['SniHost'] = request.sniHost;
  }
  if (!Util.isUnset(request.sniStatus)) {
    query['SniStatus'] = request.sniStatus;
  }
  if (!Util.isUnset(request.sourceIps)) {
    query['SourceIps'] = request.sourceIps;
  }
  if (!Util.isUnset(request.writeTime)) {
    query['WriteTime'] = request.writeTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDomain',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a domain name.
 *
 * @param request ModifyDomainRequest
 * @return ModifyDomainResponse
 */
async function modifyDomain(request: ModifyDomainRequest): ModifyDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDomainWithOptions(request, runtime);
}

model ModifyDomainIpv6StatusRequest {
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  enabled?: string(name='Enabled', description='This parameter is required.', example='0'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-mp9153****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model ModifyDomainIpv6StatusResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyDomainIpv6StatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDomainIpv6StatusResponseBody(name='body'),
}

/**
 * @param request ModifyDomainIpv6StatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDomainIpv6StatusResponse
 */
async function modifyDomainIpv6StatusWithOptions(request: ModifyDomainIpv6StatusRequest, runtime: Util.RuntimeOptions): ModifyDomainIpv6StatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.enabled)) {
    query['Enabled'] = request.enabled;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDomainIpv6Status',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyDomainIpv6StatusRequest
 * @return ModifyDomainIpv6StatusResponse
 */
async function modifyDomainIpv6Status(request: ModifyDomainIpv6StatusRequest): ModifyDomainIpv6StatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDomainIpv6StatusWithOptions(request, runtime);
}

model ModifyLogRetrievalStatusRequest {
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  enabled?: int32(name='Enabled', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model ModifyLogRetrievalStatusResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyLogRetrievalStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyLogRetrievalStatusResponseBody(name='body'),
}

/**
 * @param request ModifyLogRetrievalStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyLogRetrievalStatusResponse
 */
async function modifyLogRetrievalStatusWithOptions(request: ModifyLogRetrievalStatusRequest, runtime: Util.RuntimeOptions): ModifyLogRetrievalStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.enabled)) {
    query['Enabled'] = request.enabled;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyLogRetrievalStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyLogRetrievalStatusRequest
 * @return ModifyLogRetrievalStatusResponse
 */
async function modifyLogRetrievalStatus(request: ModifyLogRetrievalStatusRequest): ModifyLogRetrievalStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyLogRetrievalStatusWithOptions(request, runtime);
}

model ModifyLogServiceStatusRequest {
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  enabled?: int32(name='Enabled', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model ModifyLogServiceStatusResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyLogServiceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyLogServiceStatusResponseBody(name='body'),
}

/**
 * @param request ModifyLogServiceStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyLogServiceStatusResponse
 */
async function modifyLogServiceStatusWithOptions(request: ModifyLogServiceStatusRequest, runtime: Util.RuntimeOptions): ModifyLogServiceStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.enabled)) {
    query['Enabled'] = request.enabled;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyLogServiceStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyLogServiceStatusRequest
 * @return ModifyLogServiceStatusResponse
 */
async function modifyLogServiceStatus(request: ModifyLogServiceStatusRequest): ModifyLogServiceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyLogServiceStatusWithOptions(request, runtime);
}

model ModifyProtectionModuleModeRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='waf'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  mode?: int32(name='Mode', description='This parameter is required.', example='0'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model ModifyProtectionModuleModeResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyProtectionModuleModeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyProtectionModuleModeResponseBody(name='body'),
}

/**
 * @param request ModifyProtectionModuleModeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyProtectionModuleModeResponse
 */
async function modifyProtectionModuleModeWithOptions(request: ModifyProtectionModuleModeRequest, runtime: Util.RuntimeOptions): ModifyProtectionModuleModeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.mode)) {
    query['Mode'] = request.mode;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyProtectionModuleMode',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyProtectionModuleModeRequest
 * @return ModifyProtectionModuleModeResponse
 */
async function modifyProtectionModuleMode(request: ModifyProtectionModuleModeRequest): ModifyProtectionModuleModeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyProtectionModuleModeWithOptions(request, runtime);
}

model ModifyProtectionModuleRuleRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='ac_custom'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-0xldbqt****'),
  lockVersion?: long(name='LockVersion', description='This parameter is required.', example='2'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
  rule?: string(name='Rule', description='This parameter is required.', example='{"action":"monitor","name":"test","scene":"custom_acl","conditions":[{"opCode":1,"key":"URL","values":"/example"}]}'),
  ruleId?: long(name='RuleId', description='This parameter is required.', example='369998'),
}

model ModifyProtectionModuleRuleResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyProtectionModuleRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyProtectionModuleRuleResponseBody(name='body'),
}

/**
 * @param request ModifyProtectionModuleRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyProtectionModuleRuleResponse
 */
async function modifyProtectionModuleRuleWithOptions(request: ModifyProtectionModuleRuleRequest, runtime: Util.RuntimeOptions): ModifyProtectionModuleRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.lockVersion)) {
    query['LockVersion'] = request.lockVersion;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.rule)) {
    query['Rule'] = request.rule;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyProtectionModuleRule',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyProtectionModuleRuleRequest
 * @return ModifyProtectionModuleRuleResponse
 */
async function modifyProtectionModuleRule(request: ModifyProtectionModuleRuleRequest): ModifyProtectionModuleRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyProtectionModuleRuleWithOptions(request, runtime);
}

model ModifyProtectionModuleStatusRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='waf'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-zz11sr5****'),
  moduleStatus?: int32(name='ModuleStatus', description='This parameter is required.', example='1'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model ModifyProtectionModuleStatusResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyProtectionModuleStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyProtectionModuleStatusResponseBody(name='body'),
}

/**
 * @param request ModifyProtectionModuleStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyProtectionModuleStatusResponse
 */
async function modifyProtectionModuleStatusWithOptions(request: ModifyProtectionModuleStatusRequest, runtime: Util.RuntimeOptions): ModifyProtectionModuleStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.moduleStatus)) {
    query['ModuleStatus'] = request.moduleStatus;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyProtectionModuleStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyProtectionModuleStatusRequest
 * @return ModifyProtectionModuleStatusResponse
 */
async function modifyProtectionModuleStatus(request: ModifyProtectionModuleStatusRequest): ModifyProtectionModuleStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyProtectionModuleStatusWithOptions(request, runtime);
}

model ModifyProtectionRuleCacheStatusRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='tamperproof'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
  ruleId?: long(name='RuleId', description='This parameter is required.', example='42755'),
}

model ModifyProtectionRuleCacheStatusResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyProtectionRuleCacheStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyProtectionRuleCacheStatusResponseBody(name='body'),
}

/**
 * @param request ModifyProtectionRuleCacheStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyProtectionRuleCacheStatusResponse
 */
async function modifyProtectionRuleCacheStatusWithOptions(request: ModifyProtectionRuleCacheStatusRequest, runtime: Util.RuntimeOptions): ModifyProtectionRuleCacheStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyProtectionRuleCacheStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyProtectionRuleCacheStatusRequest
 * @return ModifyProtectionRuleCacheStatusResponse
 */
async function modifyProtectionRuleCacheStatus(request: ModifyProtectionRuleCacheStatusRequest): ModifyProtectionRuleCacheStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyProtectionRuleCacheStatusWithOptions(request, runtime);
}

model ModifyProtectionRuleStatusRequest {
  defenseType?: string(name='DefenseType', description='This parameter is required.', example='tamperproof'),
  domain?: string(name='Domain', description='This parameter is required.', example='www.example.com'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  lockVersion?: long(name='LockVersion', description='This parameter is required.', example='2'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId'),
  ruleId?: long(name='RuleId', description='This parameter is required.', example='42755'),
  ruleStatus?: int32(name='RuleStatus', description='This parameter is required.', example='1'),
}

model ModifyProtectionRuleStatusResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyProtectionRuleStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyProtectionRuleStatusResponseBody(name='body'),
}

/**
 * @param request ModifyProtectionRuleStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyProtectionRuleStatusResponse
 */
async function modifyProtectionRuleStatusWithOptions(request: ModifyProtectionRuleStatusRequest, runtime: Util.RuntimeOptions): ModifyProtectionRuleStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.defenseType)) {
    query['DefenseType'] = request.defenseType;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.lockVersion)) {
    query['LockVersion'] = request.lockVersion;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!Util.isUnset(request.ruleStatus)) {
    query['RuleStatus'] = request.ruleStatus;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyProtectionRuleStatus',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyProtectionRuleStatusRequest
 * @return ModifyProtectionRuleStatusResponse
 */
async function modifyProtectionRuleStatus(request: ModifyProtectionRuleStatusRequest): ModifyProtectionRuleStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyProtectionRuleStatusWithOptions(request, runtime);
}

model MoveResourceGroupRequest {
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', description='This parameter is required.', example='rg-atstuj3rtop****'),
  resourceId?: string(name='ResourceId', description='This parameter is required.', example='waf-cn-09k1rd5****~www.example.com'),
  resourceType?: string(name='ResourceType', description='This parameter is required.', example='domain'),
}

model MoveResourceGroupResponseBody = {
  requestId?: string(name='RequestId', example='C33EB3D5-AF96-43CA-9C7E-37A81BC06A1E'),
}

model MoveResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: MoveResourceGroupResponseBody(name='body'),
}

/**
 * @param request MoveResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return MoveResourceGroupResponse
 */
async function moveResourceGroupWithOptions(request: MoveResourceGroupRequest, runtime: Util.RuntimeOptions): MoveResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'MoveResourceGroup',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request MoveResourceGroupRequest
 * @return MoveResourceGroupResponse
 */
async function moveResourceGroup(request: MoveResourceGroupRequest): MoveResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return moveResourceGroupWithOptions(request, runtime);
}

model SetDomainRuleGroupRequest {
  domains?: string(name='Domains', description='This parameter is required.', example='["www.aliyundoc.com"]'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfm2pz25js****'),
  ruleGroupId?: long(name='RuleGroupId', description='This parameter is required.', example='1012'),
  wafAiStatus?: int32(name='WafAiStatus', example='1'),
  wafVersion?: long(name='WafVersion', example='1'),
}

model SetDomainRuleGroupResponseBody = {
  requestId?: string(name='RequestId', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model SetDomainRuleGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetDomainRuleGroupResponseBody(name='body'),
}

/**
 * @param request SetDomainRuleGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetDomainRuleGroupResponse
 */
async function setDomainRuleGroupWithOptions(request: SetDomainRuleGroupRequest, runtime: Util.RuntimeOptions): SetDomainRuleGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domains)) {
    query['Domains'] = request.domains;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.ruleGroupId)) {
    query['RuleGroupId'] = request.ruleGroupId;
  }
  if (!Util.isUnset(request.wafAiStatus)) {
    query['WafAiStatus'] = request.wafAiStatus;
  }
  if (!Util.isUnset(request.wafVersion)) {
    query['WafVersion'] = request.wafVersion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetDomainRuleGroup',
    version = '2019-09-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request SetDomainRuleGroupRequest
 * @return SetDomainRuleGroupResponse
 */
async function setDomainRuleGroup(request: SetDomainRuleGroupRequest): SetDomainRuleGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return setDomainRuleGroupWithOptions(request, runtime);
}

